package it.softphone.cmc.maven;

import it.softphone.cmc.CMCServiceManager;
import it.softphone.cmc.impl.ScriptletServiceClientImpl;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * 
 * @author softphone
 *
 */
public abstract class AbstractScriptletMojo extends AbstractMojo {
	public static final String NOGROUPID = "_nogroupid_";
	

	/**
	 * baseUrl
	 */
	//@MojoParameter(expression="${baseUrl}",defaultValue="http://cloumobiconn.appspot.com")
	@Parameter(property="baseUrl",defaultValue="http://cloumobiconn.appspot.com")
	private String baseUrl;
	
	/**
	 * username
	 */
	//@MojoParameter(required=true,expression="${username}", description="username")
	@Parameter(required=true,property="username")
	private String username;
	
	/**
	 * password
	 */
	//@MojoParameter(required=true,expression="${password}", description="password")
	@Parameter(required=true,property="password")
	private String password;


	protected final String getBaseUrl() {
		return baseUrl;
	}

	protected final void setBaseUrl(String baseUrl) {
		this.baseUrl = baseUrl;
	}

	protected final String getUsername() {
		return username;
	}

	protected final void setUsername(String username) {
		this.username = username;
	}

	protected final String getPassword() {
		return password;
	}

	protected final void setPassword(String password) {
		this.password = password;
	}
	

	protected ScriptletServiceClientImpl createService() {
		
		return new ScriptletServiceClientImpl( new CMCServiceManager(baseUrl, username, password));
	}
	
}
